Function: semanticdb-elisp-sym->tag

semanticdb-elisp-sym->tag is a byte-compiled function defined in db-el.el.gz.

Signature

(semanticdb-elisp-sym->tag SYM &optional TOKTYPE)

Documentation

Convert SYM into a semantic tag.

TOKTYPE is a hint to the type of tag desired.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/db-el.el.gz
(defun semanticdb-elisp-sym->tag (sym &optional toktype)
  "Convert SYM into a semantic tag.
TOKTYPE is a hint to the type of tag desired."
  (if (stringp sym)
      (setq sym (intern-soft sym)))
  (when sym
    (cond ((and (eq toktype 'function) (fboundp sym))
	   (require 'semantic/bovine/el)
	   (let ((arglist (help-function-arglist sym)))
	     (when (not (listp arglist))
	       ;; Function might be autoloaded, in which case
	       ;; the arglist is not available yet.
	       (setq arglist nil))
	     (semantic-tag-new-function
	      (symbol-name sym)
	      nil	;; return type
	      (semantic-elisp-desymbolify arglist)
	      :user-visible-flag (commandp sym))))
	  ((and (eq toktype 'variable) (boundp sym))
	   (semantic-tag-new-variable
	    (symbol-name sym)
	    nil	;; type
	    nil	;; value - ignore for now
	    ))
	  ((and (eq toktype 'type) (class-p sym))
	   (semantic-tag-new-type
	    (symbol-name sym)
	    "class"
	    (semantic-elisp-desymbolify
	     (let ((class (find-class sym)))
	       (if (fboundp 'eieio--class-public-a) ; Emacs < 25.1
		   (eieio--class-public-a class)
		 (mapcar #'eieio-slot-descriptor-name
			 (eieio-class-slots class)))))
	    (semantic-elisp-desymbolify (eieio-class-parents sym)) ;; parents
	    ))
	  ((not toktype)
	   ;; Figure it out on our own.
	   (cond ((class-p sym)
		  (semanticdb-elisp-sym->tag sym 'type))
		 ((fboundp sym)
		  (semanticdb-elisp-sym->tag sym 'function))
		 ((boundp sym)
		  (semanticdb-elisp-sym->tag sym 'variable))
		 (t nil))
	   )
	  (t nil))))